import request from "@/utils/request";

export const getRoleListService = (params) =>
  request.get("/roles/list", { params });
export const reqAddOrUpdate = (data) => {
  if (data.id) {
    return request.put(`/roles/update/${data.id}`, data);
  } else {
    return request.post("/roles/create", data);
  }
};
export const deleteRoleService = (id) => request.delete(`/roles/delete/${id}`);
export const updateRoleStatusService = (data) =>
  request.post("/roles/update/status", data);

// Get role menu list
export const getRoleMenuListService = (roleId) =>
  request.get(`/menus/role/${roleId}`);

// Assign menus to role
export const assignMenusService = (data) => request.post("/menus/assign", data);
